<template>
  <div class="game-wrap">
    <div id="phaser-game"></div>
  </div>
</template>
<script>
import Phaser from "phaser";
import MainScene from "./scenes/MainScene";

export default {
  name: "PhaserGame",
  components: {},
  data() {
    return {};
  },
  methods: {
    initConfig() {
      this.$store.dispatch("setGameConfig", {
        type: Phaser.AUTO,
        scale: {
          mode: Phaser.Scale.RESIZE,
          autoCenter: Phaser.Scale.CENTER_BOTH,
        },
        scene: [MainScene],
      });

      this.$store.dispatch(
        "initPhaser",
        new Phaser.Game(this.$store.state.gameConfig)
      );
    },
  },
  created() {
    this.initConfig();
  },
  mounted() {},
};
</script>
